home *** CD-ROM | disk | FTP | other *** search
- % Copyright (c) 1991: Marcel Roelofs and Peter Gragert
- % University of Twente, Enschede, The Netherlands
- % @@(#) underscore.web (91/03/11)
-
- @* Filter to remove underscores from REDUCE source. REDUCE does not
- allow sole underscores in identifiers. However, underscores preceded
- by an exclamation mark are allowed. Also REDUCE strings may contain
- underscores. The following C program is a filter that removes the
- forbidden underscores.
-
- @u
- #include <stdio.h>
-
- main (ac, av)
- char **av;
- {
- char c;
- while ((c=getc(stdin)) != EOF)
- if (c=='!') {
- putc(c,stdout);
- c=getc(stdin);
- putc(c,stdout);
- }
- else
- if (c=='\"') {
- while (putc(c,stdout), (c=getc(stdin)) != '\"') ;
- putc(c,stdout);
- }
- else
- if (c != '_') putc(c,stdout);
- }
-
-